import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router'
import { baseRoutes } from './modules/baseRoutes'
import { otherRouter } from './modules/otherRouter'
// 定义路由规则
const routes: Array<RouteRecordRaw> = [
  ...otherRouter,
  ...baseRoutes
]

// 创建路由实例
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes
})

// 可选：添加全局前置守卫，例如设置页面标题
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title as string
  }
  next()
})

export default router;
